<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>axios_demo</title>
</head>

<body>
    <div id="app">
        <input type="button" value="显示内容...." @click="getJoke">
        <p>{{joke}}</p>
    </div>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                joke: "一句笑话",
            },
            methods: {
                getJoke: function () {
                    var that = this;
                    axios({
                        method: 'get',
                        url: "http://103.100.211.187:8848/getTest",
                        headers: {
                            'Content-Type': 'application/json',
                        },
                    }).then(res => {
                        console.log("data:" + res.data);
                    });
                }
            }
        })
    </script>
</body>

</html>